/**
 * 
 */
package systole.domain.report;

import java.awt.image.BufferedImage;
import java.io.Serializable;

/**
 * @author jmj
 *
 */
public class Report implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = -2384188525468064364L;
    private Integer id;
    private String comments;
    private String conclusion;
    private String commentIAR;
    private String commentAOS;
    private String commentAOD;
    private String backgroundSurgeries;
    private String backgroundFamily;
    private String backgroundPathologies;
    private String backgroundMedicines;
    private String habitsSummary;
    private BufferedImage graphic;

    /**
     *
     */
    public Report() {
        super();
    }

    /**
     * @param id the id to set
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * @return the id
     */
    public Integer getId() {
        return this.id;
    }

    /**
     * @param graphic the graphic to set
     */
    public void setGraphic(BufferedImage graphic) {
        this.graphic = graphic;
    }

    /**
     * @return the graphic
     */
    public BufferedImage getGraphic() {
        return this.graphic;
    }

    /**
     * @param conclusion the conclusion to set
     */
    public void setConclusion(String conclusion) {
        this.conclusion = conclusion;
    }

    /**
     * @return the conclusion
     */
    public String getConclusion() {
        return this.conclusion;
    }

    /**
     * @return the comments
     */
    public String getComments() {
        return this.comments;
    }

    /**
     * @param comments the comments to set
     */
    public void setComments(String comments) {
        this.comments = comments;
    }

    /**
     * @return the commentIAR
     */
    public String getCommentIAR() {
        return this.commentIAR;
    }

    /**
     * @param commentIAR the commentIAR to set
     */
    public void setCommentIAR(String commentIAR) {
        this.commentIAR = commentIAR;
    }

    /**
     * @return the commentAOS
     */
    public String getCommentAOS() {
        return this.commentAOS;
    }

    /**
     * @param commentAOS the commentAOS to set
     */
    public void setCommentAOS(String commentAOS) {
        this.commentAOS = commentAOS;
    }

    /**
     * @return the commentAOD
     */
    public String getCommentAOD() {
        return this.commentAOD;
    }

    /**
     * @param commentAOD the commentAOD to set
     */
    public void setCommentAOD(String commentAOD) {
        this.commentAOD = commentAOD;
    }

    /**
     * @return the backgroundSurgeries
     */
    public String getBackgroundSurgeries() {
        return backgroundSurgeries;
    }

    /**
     * @param backgroundSurgeries the backgroundSurgeries to set
     */
    public void setBackgroundSurgeries(String backgroundSurgeries) {
        this.backgroundSurgeries = backgroundSurgeries;
    }

    /**
     * @return the backgroundFamily
     */
    public String getBackgroundFamily() {
        return backgroundFamily;
    }

    /**
     * @param backgroundFamily the backgroundFamily to set
     */
    public void setBackgroundFamily(String backgroundFamily) {
        this.backgroundFamily = backgroundFamily;
    }

    /**
     * @return the backgroundPathologies
     */
    public String getBackgroundPathologies() {
        return backgroundPathologies;
    }

    /**
     * @param backgroundPathologies the backgroundPathologies to set
     */
    public void setBackgroundPathologies(String backgroundPathologies) {
        this.backgroundPathologies = backgroundPathologies;
    }

    /**
     * @return the backgroundMedicines
     */
    public String getBackgroundMedicines() {
        return backgroundMedicines;
    }

    /**
     * @param backgroundMedicines the backgroundMedicines to set
     */
    public void setBackgroundMedicines(String backgroundMedicines) {
        this.backgroundMedicines = backgroundMedicines;
    }

    /**
     * @return the habitsSummary
     */
    public String getHabitsSummary() {
        return habitsSummary;
    }

    /**
     * @param habitsSummary the habitsSummary to set
     */
    public void setHabitsSummary(String habitsSummary) {
        this.habitsSummary = habitsSummary;
    }

    /**
     * 
     * @return all background into a string as html
     */
    public String getAllBackgroundAsHtml() {
        String background = "<html>";
        background = background.concat((this.backgroundSurgeries != null) && (!this.backgroundSurgeries.isEmpty()) ? this.backgroundSurgeries + ".<br>" : "");
        background = background.concat((this.backgroundMedicines != null) && (!this.backgroundMedicines.isEmpty()) ? this.backgroundMedicines + ".<br>" : "");
        background = background.concat((this.backgroundPathologies != null) && (!this.backgroundPathologies.isEmpty()) ? this.backgroundPathologies + ".<br>" : "");
        background = background.concat((this.backgroundSurgeries != null) && (!this.backgroundFamily.isEmpty()) ? this.backgroundFamily + ".<br>" : "");
        background = background + "</html>";
        return background;
    }

    /**
     *
     * @return all background into a string
     */
    public String getAllBackground() {
        String background = "";
        background = background.concat((this.backgroundSurgeries != null) && (!this.backgroundSurgeries.isEmpty()) ? this.backgroundSurgeries + "." + System.getProperty("line.separator") : "");
        background = background.concat((this.backgroundMedicines != null) && (!this.backgroundMedicines.isEmpty()) ? this.backgroundMedicines + "." + System.getProperty("line.separator") : "");
        background = background.concat((this.backgroundPathologies != null) && (!this.backgroundPathologies.isEmpty()) ? this.backgroundPathologies + "." + System.getProperty("line.separator") : "");
        background = background.concat((this.backgroundSurgeries != null) && (!this.backgroundFamily.isEmpty()) ? this.backgroundFamily + "." + System.getProperty("line.separator") : "");
        return background;
    }

    /**
     *
     * @return conclusion as html
     */
    public String getConclusionAsHtml() {
        String con = "<html>";
        if ((this.conclusion != null) && (!this.conclusion.isEmpty())) {
            con = con + this.conclusion.replaceAll(System.getProperty("line.separator"), "<br>");
        } else {
            con = con + "<i>" + "Debe ingresar una conclusión" + "</i>";
        }
        con = con + "</html>";
        return con;
    }

    public String getAllParamsCommentsAsHtml() {
        String com = "<html>";
        boolean iarEmpty = ((this.commentIAR == null) || (this.commentIAR.isEmpty()));
        boolean aodEmpty = ((this.commentAOD == null) || (this.commentAOD.isEmpty()));
        boolean aosEmpty = ((this.commentAOS == null) || (this.commentAOS.isEmpty()));

        if ((!iarEmpty) || (!aodEmpty) || (!aosEmpty)) {
            com = com+((iarEmpty) ? "" : this.commentIAR + "<br>");
            com = com+((aodEmpty) ? "" : this.commentAOD + "<br>");
            com = com+((aosEmpty) ? "" : this.commentAOS + "<br>");
        } else {
            com = com + "<i>No ha ingresado comentario sobre los parámetros</i>";
        }
        com = com + "</html>";
        return com;
    }

    /**
     *
     * @return AOD comment as html
     */
    public String getcommentAODAsHtml() {
        return ("<html>" + (this.commentAOD != null ? this.commentAOD : "") + "</html>");

    }

    /**
     *
     * @return AOS comment as html
     */
    public String getcommentAOSAsHtml() {
        return ("<html>" + (this.commentAOS != null ? this.commentAOS : "") + "</html>");

    }

    /**
     *
     * @return AOD comment as html
     */
    public String getcommentIARAsHtml() {
        return ("<html>" + (this.commentIAR != null ? this.commentIAR : "") + "</html>");

    }

    /**
     *
     * @return conclusion as html
     */
    public String getCommentsAsHtml() {
        String com = "<html>";
        if ((this.comments != null) && (!this.comments.isEmpty())) {
            com = com + this.comments.replaceAll(System.getProperty("line.separator"), "<br>");
        } else {
            com = com + "<i>" + "Debe ingresar un comentario" + "</i>";
        }
        com = com + "</html>";
        return com;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Report other = (Report) obj;
        if (this.getId() != other.getId() && (this.getId() == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 59 * hash + (this.getId() != null ? this.getId().hashCode() : 0);
        return hash;
    }
}
